﻿using System.ComponentModel;
using System.Web.Services;
using TripLOA.WebService.Serializable;

namespace TripLOA.WebService.Soap
{
    /// <summary>
    /// Binding per tutte le attività legate all'utente
    /// </summary>
    [WebService(Namespace = "http://triploa.cli.di.unipi.it/service/soap/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class SoapUser : System.Web.Services.WebService
    {

        #region SoapUser Constructors

        public SoapUser()
        {}

        #endregion

        #region SoapUser methods

        [WebMethod(EnableSession=true)]
        public WSUser login(string username, string password)
        {
            return UserCore.Instance.Login(username, password);
        }

        [WebMethod(EnableSession=true)]
        public WSUserProfile getProfile ( string authToken, int userId)
        {
            return UserCore.Instance.GetProfile(authToken, userId);
        }

        [WebMethod(EnableSession = true)]
        public WSUserVehicle GetUserVehicleList(string authToken)
        {
            return UserCore.Instance.GetUserVehicleList(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSNotification GetUserNotificationsList(string authToken)
        {
            return UserCore.Instance.GetUserNotifications(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSUser GetUserFriendshipRequests(string authToken)
        {
            return UserCore.Instance.GetUserFriendshipRequests(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSUser GetUserFriendshipNotifications(string authToken)
        {
            return UserCore.Instance.GetUserFriendshipNotifications(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSBool AcceptFriendshipRequest(string authToken, int friendId)
        {
            return UserCore.Instance.AcceptFriendshipRequest(authToken, friendId);
        }

        [WebMethod(EnableSession = true)]
        public WSBool DenyFriendshipRequest(string authToken, int friendId)
        {
            return UserCore.Instance.DenyFriendshipRequest(authToken, friendId);
        }

        [WebMethod(EnableSession = true)]
        public WSUser GetBuddyList(string authToken)
        {
            return UserCore.Instance.GetBuddyList(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSUser GetBannedList(string authToken)
        {
            return UserCore.Instance.GetBannedList(authToken);
        }

        [WebMethod(EnableSession = true)]
        public WSBool AddFriend(string authToken, int friendId)
        {
            return UserCore.Instance.AddFriend(authToken, friendId);
        }

        [WebMethod(EnableSession = true)]
        public WSBool RemoveFriend(string authToken, int friendId)
        {
            return UserCore.Instance.RemoveFriend(authToken, friendId);
        }

        [WebMethod(EnableSession = true)]
        public WSBool BanFriend(string authToken, int friendId)
        {
            return UserCore.Instance.BanFriend(authToken, friendId);
        }

        [WebMethod(EnableSession = true)]
        public WSBool UnbanFriend(string authToken, int friendId)
        {
            return UserCore.Instance.UnbanFriend(authToken, friendId);
        }

        #endregion
    }
}
